#ifndef SAVEDATATHREAD_H
#define SAVEDATATHREAD_H

#include <QObject>
#include <QDebug>
#include <QSettings>
#include <QDir>
#include "header.h"
#include "datafile.h"
#include "jlog.h"
#include "indexfile.h"

class SaveDataThread : public QObject
{
    Q_OBJECT
public:
    explicit SaveDataThread(QObject *parent = NULL);

private:
    DataFile df;

    bool CollectDataBuf(QVector<double>* data);
    QString PackFileName(DateTimeInfo DtInfo, int Ch);
    bool CreateFilePath(DateTimeInfo time);
    void SaveIndexFile(DateTimeInfo time);
    void WriteConfig(DateTimeInfo time);
    bool IsSDRoomSmall();
    void DeleteSDDataFile();

signals:
    void SaveDataError();    // 保存数据失败提醒
    void FinishedTrigSave(); // 保存完成信号

public slots:
    void ReceviceData(DateTimeInfo time, QVector<float>* data);
};

#endif // SAVEDATATHREAD_H
